/**
 * 当前模块进行API统一管理   统一接口管理
 * 当项目很小时，完全可以在组建中发请求，也就是说可以在组件挂载或者渲染的时候发请求
 * 对外暴露该接口，当有组建使用的时候可以直接拿到相关的数据
 */
import requests from "./request";

// 登录接口
export const reqGetLogin = data =>
  requests({ url: "http://110.40.228.197:8889/api/ding/login",
   method: "post", 
   data: data });

// 增加机器人
export const reqGetAdd = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/robot/addRobot",
    method: "post",
    data: data,
  });

// 删除机器人
export const reqGetRemove = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/robot/removeRobot",
    method: "delete",
    data: data,
  });

// 修改机器人
export const reqGetChange = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/robot/updateRobot",
    method: "put",
    data: data,
  });

// 获取用户所有机器人
export const reqGetAllUserRobot = data =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/robot/getRobotList?page=1&pageSize=10&name=&is_shared=0`,
    method: "get",
    data: data,
  });

// 获取所有机器人任务
export const reqGetAllTask = data =>
  requests({ 
    url: "http://110.40.228.197:8889/api/ding/cronTask/getTaskList",
   method: "post" ,
   data: data
  });

  //获取任务详情
  export const getTaskDetailByID = (id) =>
  requests({ 
  url: `http://110.40.228.197:8889/api/ding/cronTask/getTaskDetailByID?id=${id}`,
   method: "get" 
  });

 //获取人员详情
 export const getPersonName = (name) =>
 requests({ 
 url: `http://110.40.228.197:8889/api/ding/user/robot@user?name=${name}`,
  method: "get" 
 });



// 移除机器人任务
export const reqRemoveTask = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/cronTask/removeTask",
    method: "delete",
    data: data,
  });

// 创建定时任务
export const reqCreateTask = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/cronTask/addTask",
    method: "post",
    data: data,
  });

// // 暂停任务
// export const reqstopTask = data =>
//   requests({
//     url: "http://110.40.228.197:8889/api/ding/robot/stopTask",
//     method: "post",
//     data: data,
//   });

// // 继续任务
// export const reqRestartTask = data =>
//   requests({
//     url: "http://110.40.228.197:8889/api/ding/robot/reStartTask",
//     method: "post",
//     data: data,
//   });

// 修改任务
export const reqChangeTask = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/cronTask/updateTask",
    method: "put",
    data: data,
  });

// 查询用户
export const reqGetPreson = (name, mobile) =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/user/GetAllUsers?name=${name}&mobile=${mobile}`,
    method: "get",
  });

// 获取力扣链接地址
export const reqGetlikou = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/dept/getLeetCode",
    method: "post",
    data: data,
  });

// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// 获取公开查询内容
export const reqGetOpenRobot = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/getData",
    method: "post",
    data: data,
  });

// 公开内容上传
export const reqUpOpenRobot = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/updateData",
    method: "post",
    data: data,
  });

// 公开内容删除
export const reqRemoveOpenRobot = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/deleteData",
    method: "delete",
    data: data,
  });

// 公开内容修改
export const reqChangeOpenRobot = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/putData",
    method: "put",
    data: data,
  });

// 部门内容查询
export const reqGetDeptRobot = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/getData",
    method: "post",
    data: data,
  });

// 获取部门id
export const reqGetDeptId = () =>
  requests({ url: "http://110.40.228.197:8889/api/ding/user/getDeptIdByUserId", method: "get" });

// 增加部门资源
export const reqAddDeptMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/updateData",
    method: "post",
    data: data,
  });

// 删除部门资源
export const reqRemoveDeptMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/deleteData",
    method: "delete",
    data: data,
  });

// 修改部门资源
export const reqChangeDeptMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/putData",
    method: "put",
    data: data,
  });

// 查询部门资源
export const reqGetDeptMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/getData",
    method: "post",
    data: data,
  });

// 增加个人资源
export const reqAddPersonMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/updateData",
    method: "post",
    data: data,
  });

// 删除个人资源
export const reqRemovePersonMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/deleteData",
    method: "delete",
    data: data,
  });

// 修改个人资源
export const reqChangePersonMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/putData",
    method: "put",
    data: data,
  });

// 查询个人资源
export const reqGetPersonMsg = data =>
  requests({
    url: "http://110.40.228.197:8889/api/ding/quAndAn/getData",
    method: "post",
    data: data,
  });

// 获取考勤组  /ding/attendanceGroup/GetAttendanceGroupList
export const reqGetAttendanceGroupList = (page, pageSize) =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/attendanceGroup/GetAttendanceGroupList?page=${page}&pageSize=${pageSize}`,
    method: "get",
  });

// 获取部门信息   /ding/dept/getDeptListFromMysql
export const reqgetDeptListFromMysql = (page, pageSize,name) =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/dept/getDeptListDetail?page=${page}&pageSize=${pageSize}&name=${name}`,
    method: "get",
  });
// 更新部门信息
export const requpdateDept = dept =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/dept/updateDept`,
    method: "post",
    data: dept,
  });
// 更新考勤组信息    /ding/attendanceGroup/updateAttendanceGroup
export const requpdateAttendanceGroup = group =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/attendanceGroup/updateAttendanceGroup`,
    method: "put",
    data: group,
  });
// 同步考勤组数据到数据库
export const reqImportAttendanceGroupData = () =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/attendanceGroup/ImportAttendanceGroupData`,
    method: "get",
  });

// 更新部门信息是否在校  /ding/dept/updateSchool
// export const requpdateSchool = school =>
//   requests({
//     url: `http://110.40.228.197:8889/api/ding/dept/updateSchool`,
//     method: "put",
//     data: school,
//   });
// 查询所有钉钉用户
export const reqGetAllUsers = (name, mobile) =>
  requests({
    url: `http://110.40.228.197:8889/api/ding/user/GetAllUsers?name=${name}&mobile=${mobile}`,
    method: "get",
  });
// 根据部门id查询用户信息
// export const reqGetAllUsers = (name, mobile) => requests({ url: `http://110.40.228.197:8889/api/ding/user/GetAllUsers?name=${name}&mobile=${mobile}`, method: 'get' })
// 根据部门id查询用户信息
// export const reqGetUserByDeptid = dept_id =>
//   requests({
//     url: `http://110.40.228.197:8889/api/ding/dept/getUserByDeptid?dept_id=${dept_id}`,
//     method: "get",
//   });

// 同步部门和用户信息到数据库
export const reqImportDeptData = () =>
  requests({ url: `http://110.40.228.197:8889/api/ding/dept/ImportDeptData`, method: "get" });

// 【修改功能】设置或取消部门负责人  /ding/dept/setDeptManager
// export const reqsetDeptManager = setPer =>
//   requests({
//     url: `http://110.40.228.197:8889/api/ding/dept/setDeptManager`,
//     method: "put",
//     data: setPer,
//   });
// 更新考勤信息抄送的群 alterResultByRobot
// export const reqAlterResultByRobot = pushGroup =>
//   requests({
//     url: `http://110.40.228.197:8889/api/ding/robot/alterResultByRobot`,
//     method: "put",
//     data: pushGroup,
//   });
